import { Component, OnInit } from '@angular/core';
import { ActivatedRoute } from '@angular/router';
import { ProcessprogressService, Processprogress } from 'src/app/service/processprogress.service';

@Component({
  selector: 'app-processprogress',
  templateUrl: './processprogress.component.html',
  styleUrls: ['./processprogress.component.css']
})
export class ProcessprogressComponent implements OnInit {

  iid:number = 0;
  mill:string = '';

  tableData:Processprogress[] = [];
  constructor(
    private route:ActivatedRoute,
    private service:ProcessprogressService
  ) { 
    // 打开本页面的URL：https://www.xdfznh.club/wxpadfe/processp?iid=47547&mill=新达印染
    // 请求后端数据则是 mill 在前，实际对数据没有影响
    this.iid = this.route.snapshot.queryParams["iid"];
    this.mill = this.route.snapshot.queryParams["mill"];
    console.log('组件的构造器中获取到的传入参数是：mill=' + this.mill + ',iid' + this.iid);
    this.getTableData();
  }

  ngOnInit() {
  }

  getTableData(){
    console.log('进入业务组件方法getTableData内，两个必要的参数依次是：' + this.mill + ',' + this.iid);
    this.service.getProgress(this.mill,this.iid).subscribe(
      ( res:Processprogress[] ) =>{
        this.tableData = res;
        console.log('获取到的进度表数据是：');
        console.log(res);
        
      },error =>console.log('获取刷卡进度表时出错！')
    )
  }






}
